package com.hyt.it.ogt.ykcj.service.exam.impl;

import com.hyt.core.base.BaseServiceImpl;
import com.hyt.it.ogt.ykcj.common.utils.DateUtils;
import com.hyt.it.ogt.ykcj.domain.exam.ExamSubjectNameConfig;
import com.hyt.it.ogt.ykcj.mapper.exam.ExamSubjectNameConfigMapper;
import com.hyt.it.ogt.ykcj.service.exam.IExamSubjectNameConfigService;
import org.apache.commons.collections4.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 考试科目信息Service业务层处理
 *
 * @author admin
 * @date 2021-06-18
 */
@Service
public class ExamSubjectNameConfigServiceImpl extends BaseServiceImpl<ExamSubjectNameConfigMapper, ExamSubjectNameConfig> implements IExamSubjectNameConfigService {
    @Autowired
    private ExamSubjectNameConfigMapper examSubjectNameConfigMapper;

    /**
     * 查询考试科目信息
     *
     * @param id 考试科目信息ID
     * @return 考试科目信息
     */
    @Override
    public ExamSubjectNameConfig selectExamSubjectNameConfigById(String id) {
        return examSubjectNameConfigMapper.selectExamSubjectNameConfigById(id);
    }

    /**
     * 查询考试科目信息列表
     *
     * @param examSubjectNameConfig 考试科目信息
     * @return 考试科目信息
     */
    @Override
    public List<ExamSubjectNameConfig> selectExamSubjectNameConfigList(ExamSubjectNameConfig examSubjectNameConfig) {
        return examSubjectNameConfigMapper.selectExamSubjectNameConfigList(examSubjectNameConfig);
    }

    /**
     * 新增考试科目信息
     *
     * @param examSubjectNameConfig 考试科目信息
     * @return 结果
     */
    @Override
    public int insertExamSubjectNameConfig(ExamSubjectNameConfig examSubjectNameConfig) {
        examSubjectNameConfig.setCreateTime(DateUtils.getNowDate());
        return examSubjectNameConfigMapper.insertExamSubjectNameConfig(examSubjectNameConfig);
    }

    /**
     * 修改考试科目信息
     *
     * @param examSubjectNameConfig 考试科目信息
     * @return 结果
     */
    @Override
    public int updateExamSubjectNameConfig(ExamSubjectNameConfig examSubjectNameConfig) {
        examSubjectNameConfig.setUpdateTime(DateUtils.getNowDate());
        return examSubjectNameConfigMapper.updateExamSubjectNameConfig(examSubjectNameConfig);
    }

    /**
     * 批量删除考试科目信息
     *
     * @param ids 需要删除的考试科目信息ID
     * @return 结果
     */
    @Override
    public int deleteExamSubjectNameConfigByIds(String[] ids) {
        return examSubjectNameConfigMapper.deleteExamSubjectNameConfigByIds(ids);
    }

    /**
     * 删除考试科目信息信息
     *
     * @param id 考试科目信息ID
     * @return 结果
     */
    @Override
    public int deleteExamSubjectNameConfigById(String id) {
        return examSubjectNameConfigMapper.deleteExamSubjectNameConfigById(id);
    }

    /**
     * 查询
     *
     * @param @param  name
     * @param @param  examNameId
     * @param @return
     * @author qisw
     */
    @Override
    public List<ExamSubjectNameConfig> selectExamSubjectNameByName(String name, String examName) {
        Map<String, Object> parms = new HashedMap<>();
        parms.put("name", name);
        parms.put("examName", examName);
        List<ExamSubjectNameConfig> subNameList = examSubjectNameConfigMapper.selectExamSubjectNameByName(parms);
        return subNameList;
    }
}
